<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="https://juejin.cn/post/6844903752063778830">示例</a>
<div id="content" style="height:150px;line-height:150px;text-align:center; color: #fff;background-color:#ccc;font-size:80px;"></div>
<script>
    let num = 1;
    let content = document.getElementById('content');

    function count() {
        content.innerHTML = num++;
    };


    function debounce(func, wait) {
        let timeout;
        return function () {
            let that = this
            if (timeout) clearTimeout(timeout);
            timeout = setTimeout(function (){
                console.log(this)
                console.log('>>>  ',that)

                func.call(that)
            }, wait);
        }
    }

    content.onmousemove = debounce(count,1000);
</script>
</body>
</html>